package com.uade.magicCompany.controler;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.uade.magicCompany.controler.utitilities.ActionConstants;
import com.uade.magicCompany.services.GestionUsuarios;
import com.uade.magicCompany.services.GestionUsuariosImpl;

public class LoginAction extends ActionSupport  {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private String password;
	private String entrada;
	
	@Override
	public String execute(){
		GestionUsuarios servicio=new GestionUsuariosImpl();
		boolean result=servicio.loginUsuario(entrada, password);
		if (result){
			ActionContext.getContext().getSession().put(ActionConstants.USER_LOGGED,entrada);
			return SUCCESS;
		}	else{
			return ERROR;
		}
	}


	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getEntrada() {
		return entrada;
	}

	public void setEntrada(String entrada) {
		this.entrada = entrada;
	}


	

	
	
	
}
